from tkinter import *

XPos = int(input("Input X: "))
YPos = int(input("Input Y: "))
N = int(input("Input раз: "))
Coords = [[0, 0], [0, 20], [10, 20], [10, 30], [20, 30], [20, 10], [10, 10], [10, 0], [0, 0]]
FinalCoords = [None] * 18
Index = 0
Broken = False

for Coord in Coords:
    if not Broken:
        X = Coord[0] * N + XPos
        Y = Coord[1] * N + YPos
        FinalCoords[Index] = X
        FinalCoords[Index + 1] = Y
        Index += 2

        if X > 500:
            print("X is too high!")
            Broken = True
        elif Y > 500:
            print("Y is too high!")
            Broken = True
        elif N <= 0:
            print("N should be above 0")
            Broken = True
            
print(FinalCoords)

if not Broken:
    Root = Tk()
    Root.title("IT марафон")
    Root.geometry("500x500")
    Canvass = Canvas(bg="white", width=500, height=500)
    Canvass.pack(anchor=CENTER, expand=1)
    Canvass.create_polygon(FinalCoords)
    Root.mainloop()